'use strict';
const path = require('path');
const cwd = process.cwd();

const buildConf = require('../entry/entryConf.js');
// 工作空间根目录
const mainRootPath = path.join(cwd, `./${buildConf.repertoryPath}`);
const cProcess = require("child_process");
process.chdir(mainRootPath);
const out = cProcess.exec(`webpack-dev-server --inline --progress --config ${path.join(cwd, `./ctools.conf/server/serverConf.js`)}`, {
  maxBuffer: 2000*1024,
},e => {
  if (e) console.log(e);
});
out.stdout.on('data', (data) => {
  console.log(`stdout: ${data}`);
});

out.stderr.on('data', (data) => {
  console.log(`stderr: ${data}`);
});

out.on('close', (code) => {
  console.log(`子进程退出码：${code}`);
});
